/*
 * Copyright 2021-2030 itbox.cn All right reserved. This software is the confidential and proprietary information
 * of itbox.cn ("Confidential Information"). You shall not disclose such Confidential Information and shall use it
 * only in accordance with the terms of the license agreement you entered into with itbox.cn.
 */

package cn.itbox.example.test.controller;

import cn.itbox.uap.uid.client.UidServiceClient;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @BelongProject springboot-study
 * @BelongPackage cn.itbox.example.test.controller
 * @Description TODO
 * @ClassName IdgeneratorController
 * @Author xingc
 * @Date 2023/11/26 17:09
 * @Version 1.0.0
 */

@Slf4j
@RestController
@RequestMapping("/uid")
public class IdgeneratorController {
    @Resource
    private UidServiceClient uidServiceClient;

    @GetMapping("/nextid")
    public Long nextId() {
        Long nextId = uidServiceClient.getId();
        return nextId;
    }

    @GetMapping("/batchids/{size}")
    public List<Long> batchIds(@PathVariable("size") Integer size) {
        List<Long> idList = uidServiceClient.getBatchIds(size);
        return idList;
    }
}
